import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/redirect',
    name: 'Redirect',
    component: () => import('@/layout/index.vue'),
    redirect: '/dashboard',
    children: [
      {
        path: '/redirect/:path(.*)',
        name: 'RedirectPath',
        component: () => import('@/views/redirect/index.vue'),
        meta: {}
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '登录',
      hidden: true
    }
  },
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: {
          title: '数据统计'
        }
      },
      {
        path: 'user',
        name: 'User',
        component: () => import('@/views/user/index.vue'),
        meta: {
          title: '帐号管理'
        }
      },
      {
        path: 'role',
        name: 'Role',
        component: () => import('@/views/role/index.vue'),
        meta: {
          title: '角色列表'
        }
      },
      {
        path: 'loginLog',
        name: 'LoginLog',
        component: () => import('@/views/loginLog/index.vue'),
        meta: {
          title: '登录日志'
        }
      },
      {
        path: 'operateLog',
        name: 'OperateLog',
        component: () => import('@/views/operateLog/index.vue'),
        meta: {
          title: '操作日志'
        }
      },
      {
        path: '/carousel',
        name: 'Carousel',
        component: () => import('@/views/carousel/index.vue'),
        meta: {
          title: '轮播图列表'
        }
      },
      {
        path: '/server',
        name: 'Server',
        component: () => import('@/views/server/index.vue'),
        meta: {
          title: '系统信息'
        }
      },
      {
        path: '/redis',
        name: 'Redis',
        component: () => import('@/views/redis/index.vue'),
        meta: {
          title: 'Redis 缓存'
        }
      },
      {
        path: '/dynamicThreadPool',
        name: 'DynamicThreadPool',
        component: () => import('@/views/dynamicThreadPool/index.vue'),
        meta: {
          title: '线程池管理'
        }
      },
      {
        path: '/dbDoc',
        name: 'DbDoc',
        component: () => import('@/views/dbDoc/index.vue'),
        meta: {
          title: '数据库文档'
        }
      },
      {
        path: '/dict',
        name: 'Dict',
        component: () => import('@/views/dict/index.vue'),
        meta: {
          title: '字典管理'
        }
      },
      {
        path: '/dictData',
        name: 'DictData',
        component: () => import('@/views/dict/data/index.vue'),
        meta: {
          title: '字典数据'
        }
      },
      {
        path: '/area',
        name: 'Area',
        component: () => import('@/views/area/index.vue'),
        meta: {
          title: '地区列表'
        }
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: '404',
    component: () => import('@/views/404/index.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
